home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 436_01 / incon.doc < prev    next >
Encoding:
Text File  |  1994-10-07  |  64.5 KB  |  1,783 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.                                    INCON.DOC
  20.  
  21.                     Documentation for INCON (INput CONtrol)
  22.  
  23.                                   Version 3.1
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.                                  Richard Zigler
  44.  
  45.                                    PO Box 152
  46.  
  47.                             McBain, MI   49657-0152
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                     Contents
  74.  
  75.  
  76.      Copyright Notice and Disclaimer.................................2
  77.      Introduction....................................................3
  78.         Basic Operation..............................................3
  79.      INCON Parameters................................................3
  80.         BufOff.......................................................4
  81.         BufSeg.......................................................4
  82.         KeyOff.......................................................4
  83.         KeySeg.......................................................4
  84.         Flags........................................................5
  85.            Debug.....................................................5
  86.            Type......................................................5
  87.            Justify...................................................6
  88.            Strip.....................................................6
  89.            Message...................................................6
  90.            Sign......................................................7
  91.            Display...................................................7
  92.            Confirm...................................................7
  93.            Delimit...................................................7
  94.            xKeys.....................................................7
  95.            Scroll....................................................8
  96.            Hide......................................................8
  97.            Template..................................................8
  98.         Width........................................................9
  99.         Prec........................................................10
  100.         Visible.....................................................10
  101.         Attr........................................................10
  102.         Fill........................................................10
  103.         Pad.........................................................10
  104.      Setting up the Message Block and Calling INCON.................11
  105.      Extended-Key Trapping..........................................11
  106.         Special Exit Keys...........................................12
  107.      Setting Up and Editing Input Fields............................13
  108.         Input Templates.............................................14
  109.         Floating-point Fields.......................................16
  110.         Scrolling Fields............................................18
  111.      Return Codes...................................................18
  112.      Run-Time Errors................................................20
  113.         Error Trapping..............................................21
  114.      Figures and Tables.............................................23
  115.         Figure 1.  INCON Message Block..............................23
  116.         Figure 2.  INCON Flags......................................23
  117.         Figure 3.  The INCON Interface..............................24
  118.         Figure 4.  The INCON Stat Box...............................25
  119.         Table  1.  INCON's Handling of [Numpad +] and [Numpad -]....25
  120.         Table  2.  INCON Edit Keys..................................26
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.      INCON.DOC                                                       1
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                         Copyright Notice and Disclaimer
  140.  
  141.  
  142.           For purposes of this Notice and Disclaimer, "INCON" means the
  143.      INCON source and header files, this document, and any other software
  144.      and documentation supplied as an adjunct to INCON, all of which are
  145.  
  146.           Copyright (c) 1993-94, by Richard Zigler.
  147.      
  148.      INCON may be freely copied and distributed but not modified or sold
  149.      for profit, either as a discrete product or as part of a commercial
  150.      product, without written consent of the author, except that software
  151.      libraries may charge a nominal fee for a disk containing INCON.
  152.  
  153.           You undertake to use INCON at your own risk.  The author assumes
  154.      no liability for damages resulting from your use of INCON and makes no
  155.      warranty of any kind with regard to INCON and its use.
  156.  
  157.           Address questions, suggestions, or comments to:
  158.  
  159.                                  Richard Zigler
  160.                                    PO Box 152
  161.                              McBain, MI  49657-0152
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.      INCON.DOC                                                       2
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                                   Introduction
  206.  
  207.  
  208.           INCON is an MS-DOS input management library that helps you build
  209.      sophisticated data input screens.  INCON gives you control over the
  210.      placement and appearance of input fields, and the type and amount of
  211.      data that each will accept.  Input fields may be alphanumeric,
  212.      uppercase, integer, or floating-point.
  213.  
  214.           You may pass an ASCIIZ string to INCON and specify that it be
  215.      treated as default input or as an input template, or both.  Templates
  216.      may be alpha, numeric, or mixed.  You may specify that fields scroll,
  217.      that they be delimited, that user input be hidden, and that input be
  218.      returned to your program left- or right-justified or centered in a
  219.      field whose width and "pad" character you select.  A number of
  220.      reserved edit keys give users of your programs extensive input editing
  221.      capabilities.  Several assembly language string-handling routines are
  222.      available as part of INCON and in a separate object file.
  223.  
  224.  
  225.      Basic Operation
  226.  
  227.           The basic operation of the program is as follows:
  228.  
  229.           1. The calling routine defines a block of parameters, among which
  230.           is a far pointer to an i/o buffer.
  231.  
  232.           2. At entry, INCON copies any string in the i/o buffer to an
  233.           internal work buffer and may then display it as default input or
  234.           use it to construct an input template, or both.
  235.  
  236.           3. User keyboard entries are examined.  INCON acts upon its
  237.           reserved keys immediately.  It returns extended-key codes that it
  238.           finds in a list provided by the calling routine and cancels the
  239.           input operation.  It displays and saves in the work buffer all
  240.           entries that are appropriate to the field type; it discards all
  241.           others.
  242.  
  243.           4. If the operation succeeds, INCON copies user input to the i/o
  244.           buffer, overwriting its previous contents.  If it fails or is
  245.           canceled, INCON discards any user input it has so far gathered.
  246.  
  247.           5. INCON returns a code to the calling routine that indicates
  248.           input status or whether the user has made a special request.
  249.  
  250.  
  251.  
  252.                                 INCON Parameters
  253.  
  254.  
  255.           Parameters occupy a "message block," to which you pass a far
  256.      pointer in the call to INCON.  The message block is defined as a C
  257.      data object called a union, which allows data of different types to
  258.      share the same memory area, or, to look at it another way, data in a
  259.  
  260.  
  261.  
  262.      INCON.DOC                                                       3
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.      given memory area to be addressed as different types.  The message
  272.      block is defined as both an array of unsigned integers and a structure
  273.      comprising data of various types.  That makes it possible for
  274.      languages that don't offer structured-data capabilities or bit-level
  275.      operators to access the message block as a simple array, using logical
  276.      and arithmetic operators.
  277.  
  278.           Declarations and definitions for the message block are in the
  279.      header file INDEFS.H.  The message block is arranged as in Figure 1.
  280.      Parameters are unsigned, limiting the range of byte-size quantities to
  281.      0 to 255.
  282.  
  283.           Note that you don't pass the input field screen coordinates.  One
  284.      of the first things that INCON does is determine for itself the
  285.      absolute coordinates of the current cursor position.  You may use
  286.      INCON to set up input fields in programs that employ text windows,
  287.      without worrying about coordinate translation; just put the cursor
  288.      where you want the field to appear before issuing the call.  You must
  289.      ensure, however, that the field does not extend beyond the boundaries
  290.      of its host window.
  291.  
  292.  
  293.      BufOff
  294.  
  295.           Offset address of the i/o buffer.  Prior to calling INCON, you
  296.           may load the buffer with a null-terminated string and, depending
  297.           on the condition of the Template flag (see below), INCON treats
  298.           the string either as default input or as an input template, or
  299.           both.  INCON copies user input to the buffer before returning to
  300.           the calling program.
  301.  
  302.  
  303.      BufSeg
  304.  
  305.           Segment address of i/o buffer.
  306.  
  307.  
  308.      KeyOff
  309.  
  310.           Offset address of a list of extended-key codes.  Extended keys
  311.           are those that have some special purpose, such as cursor and
  312.           function keys.  INCON reserves several extended keys for its own
  313.           use (see Table 2); the others are available for use by your
  314.           program.  See the discussion of the xKeys flag and "Extended-Key
  315.           Trapping," below.
  316.  
  317.           Do not include INCON's edit keys in the extended-key list.
  318.  
  319.  
  320.      KeySeg
  321.  
  322.           Segment address of the extended-key list.
  323.  
  324.  
  325.  
  326.  
  327.  
  328.      INCON.DOC                                                       4
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.      Flags
  338.  
  339.           Flags that modify INCON's behavior, arranged as in Figure 2.  The
  340.           flags word is declared separately in INDEFS.H as the union of an
  341.           unsigned integer and a bit-field; should you need to manipulate
  342.           individual flags, you may declare a variable of type FLAGS to
  343.           simplify access.  In the following discussion, "set" means a one-
  344.           bit flag is one; "clear" means it is zero.
  345.  
  346.           Debug
  347.  
  348.             This flag has two purposes.  If set, it turns on
  349.             INCON's run-time error messaging (see Message), and
  350.             it makes available another debugging aid, described
  351.             below.
  352.  
  353.             INCON attempts to recover from errors that the
  354.             programmer may make in setting up an input field and
  355.             supplies defaults for some parameters that are not
  356.             specified.  As a result, INCON may modify some of the
  357.             flags and other parameters.  If INCON.C, the main
  358.             source file, is compiled with the constant
  359.             INCON_STATS set to 1, the Debug flag also tells INCON
  360.             to create a "Stat Box" that lists all parameters and
  361.             flags after field initialization.  The Stat Box may
  362.             then be toggled on and off with the [Numpad 5] key as
  363.             long as Debug remains set.  See "Setting Up and
  364.             Editing Input Fields" and "Error Trapping."
  365.  
  366.           Type
  367.  
  368.             This flag determines the characters that are
  369.             acceptable as input.  Valid characters for each type
  370.             are:
  371.  
  372.                0 - Alpha.
  373.                      ASCII characters in the range 32-255, except
  374.                      127.
  375.                      
  376.                1 - Uppercase.
  377.                      Same as 0; a-z converted to A-Z.
  378.                      
  379.                2 - Integer.
  380.                      Decimal digits and optional sign only.
  381.                      
  382.                3 - Floating-point.
  383.                      Decimal digits, decimal point, and optional
  384.                      sign.
  385.                      
  386.                4 - Mixed.
  387.                      Template fields:  Decimal digits or alpha
  388.                      characters only (no punctuation).
  389.                      Non-template fields:  same as 0.
  390.                
  391.  
  392.  
  393.  
  394.      INCON.DOC                                                       5
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.             If INCON finds a decimal point in the default string
  404.             of a non-template integer field, it converts the
  405.             field to signed floating-point; if it finds a leading
  406.             sign character, it sets the Sign flag; if it finds
  407.             any other non-digit character, including a sign in
  408.             any position but the first, it truncates the string
  409.             at that character.
  410.  
  411.             INCON returns all input types as ASCIIZ strings
  412.             (null-terminated, no imbedded length); numeric
  413.             conversions are left to the caller.
  414.  
  415.             See the discussion of the Template flag and "Setting
  416.             Up and Editing Input Fields" for more on numeric
  417.             types and input templates.
  418.  
  419.           Justify
  420.  
  421.             Allows input to be returned so as to fit a formatted
  422.             data scheme.
  423.  
  424.                0 - User input is returned as entered.
  425.                      
  426.                1 - User input is left-justified in a field of
  427.                      Width characters (see also Pad).
  428.                      
  429.                2 - User input is centered.
  430.                      
  431.                3 - User input is right-justified.
  432.                
  433.             This flag has no affect on floating-point and
  434.             template fields.  Integer fields are right-justified
  435.             by default.  See "Setting Up and Editing Input
  436.             Fields."
  437.  
  438.           Strip
  439.  
  440.             Template fields only.  If set, INCON returns user
  441.             input stripped of all template delimiters.  If clear,
  442.             INCON returns the entire string from the input field.
  443.             See Template.
  444.  
  445.             Among the string-handling routines mentioned above is
  446.             one that restores stripped template data to their
  447.             original format so that you can present existing data
  448.             for editing.  See "Setting Up and Editing Input
  449.             Fields."
  450.  
  451.           Message
  452.  
  453.             In addition to returning an error code, INCON beeps
  454.             and displays an error message when it detects any of
  455.             several run-time errors.  While developing a program,
  456.             you may wish to enable messages; once the program is
  457.  
  458.  
  459.  
  460.      INCON.DOC                                                       6
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.             finished, clear this flag to suppress them (the error
  470.             code is still returned).  Setting Debug also turns on
  471.             this flag.  See "Run-Time Errors."
  472.  
  473.           Sign
  474.  
  475.             If set, the user may enter a sign character in the
  476.             first position of floating-point and non-template
  477.             integer fields.  If INCON finds a leading sign
  478.             character in the default input string passed to those
  479.             field types, it sets Sign automatically.
  480.  
  481.             INCON prevents the user from entering a sign
  482.             character in numeric templates by clearing Sign for
  483.             those fields.  The user may still flag input as
  484.             positive or negative by using the "+" and "-" keys on
  485.             the numeric keypad.  See "Extended-Key Trapping" and
  486.             "Setting Up and Editing Input Fields."
  487.  
  488.           Display
  489.  
  490.             Template fields only.  If set, INCON displays the
  491.             entire string in the i/o buffer and treats the "input
  492.             slot" indicators as default input, which allows you
  493.             to present for editing data that has already been
  494.             formatted, as from a database.  If clear, it displays
  495.             only the template delimiters.  See Template.
  496.  
  497.           Confirm
  498.  
  499.             If set, the user must press [Enter] to confirm input;
  500.             if clear, INCON exits as soon as the input field is
  501.             filled.  See "Setting Up and Editing Input Fields."
  502.  
  503.           Delimit
  504.  
  505.             If set, INCON displays delimiters ("[" and "]") at
  506.             each end of the input field.  If part of a scrolling
  507.             field is out of view, the delimiters change to "<"
  508.             and ">" to indicate that the field contains data to
  509.             the left or right.  Delimiters are most useful for
  510.             check boxes and when you don't want to use a
  511.             contrasting color to set off the input field from the
  512.             rest of the screen.
  513.  
  514.             Setting this flag increases the field width
  515.             requirement by two, which may lead to an unexpected
  516.             field width error.  See "Run-Time Errors."
  517.  
  518.           xKeys
  519.  
  520.             If set, INCON searches the list at KeySeg:KeyOff when
  521.             the user presses an extended key that is not among
  522.             its reserved keys; if clear, it ignores those keys.
  523.  
  524.  
  525.  
  526.      INCON.DOC                                                       7
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.             If INCON finds the key in the list, it aborts the
  536.             input operation and returns the extended key code to
  537.             the calling routine; otherwise it produces a warning
  538.             beep.  See "Extended-Key Trapping."
  539.  
  540.           Scroll
  541.  
  542.             INCON does not attempt to manage line-wrap in an
  543.             input field.  If an alpha field is too long for one
  544.             line, set this flag to allow characters to move into
  545.             and out of the visible field as the user edits the
  546.             input string.  Place the number of characters to
  547.             display in Visible (see below).
  548.  
  549.             INCON turns off scrolling for integer and floating-
  550.             point fields, or if either of the Template or Hide
  551.             flags is set.  It turns on scrolling if an alpha
  552.             field is wider than the space remaining on the screen
  553.             row; it also turns off delimiters and sets Visible so
  554.             as to carry the field to the end of the row.
  555.  
  556.           Hide
  557.  
  558.             Alpha and template fields only.  For gathering secure
  559.             data, such as passwords, set this flag to prevent
  560.             user input from being displayed on the screen.  To
  561.             mark the progress of input visually, INCON writes
  562.             spaces to the screen as the user makes entries into
  563.             the input field; it replaces the spaces with the
  564.             contents of Fill as the user makes deletions.  It
  565.             initially displays a string passed in the i/o buffer
  566.             if Display is set, so you could put a prompt that
  567.             indicates the kind of data that is required in the
  568.             field itself.
  569.  
  570.             INCON disables scrolling, as well as all edit keys
  571.             except [Backspace], [Esc], and the exit keys, when
  572.             this flag is set.  Extended-key trapping is not
  573.             affected.
  574.  
  575.           Template
  576.  
  577.             If set, INCON treats the string passed in the i/o
  578.             buffer as an input template.  A template field has
  579.             two types of character positions:  "input slots" into
  580.             which the user may enter data; and "template
  581.             delimiters" to which the user has no access at all.
  582.  
  583.             Characters accepted as input depend upon the input
  584.             Type (see above).  For alpha templates, an alpha
  585.             character in the i/o buffer defines an input slot;
  586.             all others define delimiters.  For integer templates,
  587.             only digits define input slots.
  588.  
  589.  
  590.  
  591.  
  592.      INCON.DOC                                                       8
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.             For mixed templates, alpha and digit characters
  602.             define input slots, but the range of input into alpha
  603.             slots is more restricted than it is for alpha
  604.             templates.  INCON accepts only alpha entries, no
  605.             punctuation, in those slots.  In addition, it
  606.             converts to uppercase any entry into a slot defined
  607.             by an uppercase alpha character in the template
  608.             string.
  609.  
  610.             The following string might be passed in the i/o
  611.             buffer as a template for phone numbers:
  612.  
  613.                (999) 999-9999
  614.                
  615.             Type should specify integer input.  If Display is set
  616.             the input field appears as above, and INCON treats
  617.             the nines as default user input.  If Display is clear
  618.             and Fill is defined as ASCII 46, the input field
  619.             appears as
  620.  
  621.                (...) ...-....
  622.                
  623.             In either case, the user has access only to the input
  624.             slots marked by the 9s in the template string.
  625.  
  626.             Note that the choice of Fill character may have an
  627.             impact on the operation of template fields.  In the
  628.             example above, one of the delimiters is a space
  629.             character.  If Fill is also defined as the space
  630.             character, INCON will never recognize that the user
  631.             has entered valid data.  See "Run-Time Errors" and
  632.             "Input Templates."
  633.  
  634.             The Strip flag affects template fields in much the
  635.             same way as the "R" option in dBASE Picture
  636.             Functions.  If Strip is set and the user enters
  637.             "1234567890" into the example field above, INCON
  638.             returns "1234567890"; if Strip is clear, INCON
  639.             returns "(123) 456-7890".
  640.  
  641.             At exit, all input slots must contain valid data;
  642.             otherwise, INCON returns an error code and discards
  643.             any user input.
  644.  
  645.             Scrolling is disabled when this flag is set.
  646.  
  647.  
  648.      Width
  649.  
  650.           The maximum number of characters allowed in the input field,
  651.           including the sign in numeric fields and the decimal in floating-
  652.           point fields.
  653.  
  654.  
  655.  
  656.  
  657.  
  658.      INCON.DOC                                                       9
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.      Prec
  668.  
  669.           Alpha and integer fields:  the minimum acceptable number of input
  670.           characters.  INCON discards user input and returns -1 if the user
  671.           exits a field that contains fewer than Prec characters.
  672.  
  673.           Floating-point fields:  the number of digits to the right of the
  674.           decimal point.  If the user enters fewer than Prec digits to the
  675.           right of the decimal point, INCON pads the field with zeros.  If
  676.           the user exits an empty field, the return string is "0.", padded
  677.           out with Prec zeros.
  678.  
  679.           Template fields:  INCON sets Prec from Width, but Prec does not
  680.           figure in its determination of the validity of input; the field
  681.           must be filled completely for input to be valid.
  682.  
  683.  
  684.      Visible
  685.  
  686.           Specifies the length of the visible portion of scrolling alpha
  687.           fields.  If Width is too long to fit within the confines of a
  688.           window, put the number of characters to display here and set
  689.           Scroll.  Characters move into and out of view as the user edits
  690.           or moves through the input field.  If Scroll is clear, INCON sets
  691.           Visible from Width.
  692.  
  693.  
  694.      Attr
  695.  
  696.           Input field colors, specified as an IRBG attribute byte.  If 0,
  697.           INCON reverses the current screen attribute and preserves the
  698.           intensity bit.  If the foreground and base background colors in
  699.           Attr are the same, INCON sets the intensity bit.  Therefore, you
  700.           normally can't use Attr to get hidden input (see Hide), though
  701.           you can fool INCON by turning off the blink attribute, which
  702.           makes 16 background colors available.  If you want to get your
  703.           users' attention, or just annoy the hell out of them, you can set
  704.           up a blinking input field.
  705.  
  706.  
  707.      Fill
  708.  
  709.           The character INCON uses to fill unoccupied portions of the input
  710.           field, as a visual guide to the user.  You may specify any value
  711.           (0-255) here, but if Fill is less than 32 INCON uses the space
  712.           character.
  713.  
  714.  
  715.      Pad
  716.  
  717.           The character INCON uses to pad the i/o buffer when justified
  718.           input does not fill it completely (see Justify, above).  The
  719.           range of values is the same as for Fill.
  720.  
  721.  
  722.  
  723.  
  724.      INCON.DOC                                                      10
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.           If an integer field will be converted to a number, Pad must be
  734.           acceptable to the conversion routine.  INCON uses leading spaces
  735.           and trailing zeroes (ASCII 48) to pad floating-point fields,
  736.           regardless of the character specified here.  See "Setting Up and
  737.           Editing Input Fields."
  738.  
  739.  
  740.  
  741.                  Setting up the Message Block and Calling INCON
  742.  
  743.  
  744.           Figure 3 shows the steps reuired to set up a message block and
  745.      call INCON.  As mentioned above, you may treat the message block as
  746.      either a structure or an array of unsigned integers.  A message block
  747.      is defined in Figure 3a and initialized as an array in Figure 3b.
  748.  
  749.           The value assigned to the flags in Figure 3b is comprised of
  750.      several constants defined in INDEFS.H.  The flags tell INCON that
  751.      nblock expects integer input and to right-justify user input in the
  752.      i/o buffer for return to the caller (which INCON would do by default,
  753.      since nblock defines an integer field).  INCON displays as default
  754.      input any string that occupies the i/o buffer at entry.  The user must
  755.      press [Enter] to confirm input, and, since extended-key trapping is
  756.      enabled, the user may cancel input by pressing a key in the extended-
  757.      key list.
  758.  
  759.           INDEFS.H defines constants for setting, shifting, and masking
  760.      individual flags.  The constants assigned in Figure 3b to Width, Prec,
  761.      and so on are defined in the INCON demonstration program, INDEMO.C;
  762.      their specific values are not important for purposes of illustration.
  763.  
  764.           A far pointer to the message block is defined in Figure 3c and
  765.      passed to INCON in Figure 3d.  INCON is declared as a Pascal type, so
  766.      its name may appear in mixed case, as shown, or in uppercase.
  767.  
  768.  
  769.  
  770.                              Extended-Key Trapping
  771.  
  772.  
  773.           To give users a means of communicating special requests to your
  774.      program, you may define a list of extended-key codes for INCON to
  775.      search when extended-key trapping is enabled (the xKeys flag is set).
  776.      INCON treats the list as a C string, so it must end with a null byte.
  777.  
  778.           If xKeys is set, INCON cancels input when the user presses an
  779.      extended key in the list.  It discards any user input and returns the
  780.      extended code to the caller.  Extended-key trapping offers a more
  781.      powerful means of aborting input than a simple "cancel" key.  You may,
  782.      for example, define keys that allow your program to respond
  783.      immediately to user requests for services such as navigating a menu or
  784.      obtaining help.
  785.  
  786.  
  787.  
  788.  
  789.  
  790.      INCON.DOC                                                      11
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.           The following example defines a list of unshifted function keys,
  800.      along with [Tab] and [Shift+Tab].  Note the 0 byte that terminates the
  801.      list.
  802.  
  803.           static unsigned char xKeyList[] =
  804.                {9, 15, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 0};
  805.  
  806.           To disable extended-key trapping you may define the list as a
  807.      null string (a single zero byte), pass a null pointer in xKeyList
  808.      (zeros in KeyOff and KeySeg), or clear the xKeys flag.
  809.  
  810.           Though the unshifted [Tab] is not an extended key, INCON treats
  811.      it as such if you include its ASCII code in the list.  Since ASCII 9
  812.      has no analogue among extended codes, it does not mask any of them.
  813.  
  814.           INCON returns extended codes in the LOW byte of the return value.
  815.      Since the only positive non-zero returns from INCON represent either
  816.      [Esc], [Tab], [Numpad +], [Numpad -], or an extended key, all are
  817.      readily identifiable.
  818.  
  819.  
  820.      Special Exit Keys
  821.  
  822.           INCON gives special handling to two extended keys, [Numpad +] and
  823.      [Numpad -].  In alpha fields, they map to the regular [+] and [-]
  824.      keys.  In mixed templates, they are ignored.  In integer templates,
  825.      they act as special exit keys.  In floating-point and non-template
  826.      integer fields, however, INCON treats them as either regular ASCII
  827.      keys or special exit keys, depending upon the condition of the Sign
  828.      flag and the position of the cursor.
  829.  
  830.           If Sign is set AND the cursor is at the beginning of the field,
  831.      they act as alternates to the upper row [+] and [-] keys.  If Sign is
  832.      clear OR the cursor is NOT at the beginning of the field, INCON treats
  833.      them as exit keys and returns their scan codes.  That can be useful
  834.      when you have set up a numeric field of a particular size and don't
  835.      want to dedicate a position to the sign.  Your program can still
  836.      determine whether the entered quantity is positive or negative.
  837.  
  838.           None of the conditions set by Template or Prec is relaxed.  All
  839.      input slots in an integer template must contain valid data; non-
  840.      template integer fields must receive at least Prec digits of input.
  841.      INCON returns -1, not the extended codes, if the user exits without
  842.      having met those conditions.
  843.  
  844.           [Numpad +] and [Numpad -] need not be included in xKeyList; INCON
  845.      handles them internally, as summarized in Table 1.
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.      INCON.DOC                                                      12
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.                       Setting Up and Editing Input Fields
  866.  
  867.  
  868.           This version of INCON operates in insert mode in alpha fields and
  869.      in overstrike mode in numeric fields and templates.  No provision for
  870.      switching modes is supported.
  871.  
  872.           Width and Visible settings may allow the input field to extend
  873.      beyond the boundaries of a window defined by the calling program.  The
  874.      caller must manage INCON's parameters to conform to the dimensions of
  875.      any window that hosts an input field.
  876.  
  877.           INCON makes its own modest use of windowing to display its "Stat
  878.      Box" if you've set Debug and are using a version of the library
  879.      compiled with the constant INCON_STATS set to 1 (see the Debug flag
  880.      and "Error Trapping").  The Stat Box is toggled with the [Numpad 5]
  881.      key; while it is displayed, all other keys are ignored.  INCON saves
  882.      and restores the screen under the Stat Box.
  883.  
  884.           INCON reserves several keys, listed in Table 2, for editing input
  885.      fields.  If Hide is set, all keys in Table 2 are disabled except for
  886.      [Backspace], [Esc], [Numpad +], [Numpad -], and [Enter].  The Hide
  887.      flag does not affect extended-key trapping.
  888.  
  889.           INCON's initial placement of the cursor in the input field
  890.      depends upon the field type.  The cursor appears in integer and
  891.      scrolling fields at the start of the field, in non-scrolling alpha
  892.      fields at the end of the default input string, in template fields at
  893.      the first input slot, and in floating-point fields at the first
  894.      character of the default input string.
  895.  
  896.           If the user hits a key that is not appropriate to the field type
  897.      or attempts to move the cursor outside the boundaries of the input
  898.      field, INCON issues a warning beep.  The same is true when the cursor
  899.      is not at the end of an alpha field that is filled to capacity and the
  900.      user attempts to enter more characters into the field, a situation
  901.      that is discussed further below.
  902.  
  903.           If the first entry in a field is a valid character, INCON clears
  904.      the default input string and places the character at the beginning of
  905.      the field, or in the first input slot.  If, however, the first entry
  906.      is any key that causes the cursor to move, INCON places subsequent
  907.      characters at the cursor position; the default string is not cleared.
  908.      In short, fields work basically as follows:  to accept the default
  909.      input string, press [Enter]; to edit the string, use the edit keys; to
  910.      replace the string, just start typing.
  911.  
  912.           Beware of a situation with alpha fields in which INCON appears to
  913.      freeze.  Suppose you've set up a CONFIRMED field and a default input
  914.      string that fills it.  That may result either from your own settings
  915.      or, without your knowing it, if you've left it to INCON to set the
  916.      field width from the length of the default string.  If the first entry
  917.      in the field moves the cursor out of its initial position, INCON will
  918.      refuse to accept any valid entries because the field is already filled
  919.  
  920.  
  921.  
  922.      INCON.DOC                                                      13
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.      to capacity.  That situation is most likely to arise in a scrolling
  932.      field in which the end of the string is out of view, and the cursor is
  933.      placed initially at the start of the field.  You can tell INCON hasn't
  934.      gone witless because, with each keypress, you'll hear a warning beep
  935.      that indicates the field is filled.  To make entries into the field
  936.      you must clear it or delete a few characters.
  937.  
  938.           By contrast, given a similar UNCONFIRMED field, INCON will exit
  939.      immediately with the first entry of any kind.  In neither case is
  940.      INCON behaving inconsistently, but those situations can take you by
  941.      surprise.  It is best not to leave too many decisions to INCON; set
  942.      the parameters you want so that INCON doesn't have to.  And be sure to
  943.      give yourself plenty of room; overly long alpha fields can be
  944.      scrolled.
  945.  
  946.           You may specify that user input from non-template alpha and
  947.      integer fields be returned to your program either left-justified,
  948.      right-justified, or centered.  Integer fields are right-justified by
  949.      default, but you can override that by setting Justify to Left or
  950.      Centered.  INCON takes the total length of the returned string from
  951.      Width, and the character that fills out the string from Pad.
  952.  
  953.           The justification routines and a number of other string-handling
  954.      routines are public, so you may call them directly from your own
  955.      programs.  They also are available separately by linking STRINGZ.OBJ
  956.      to programs that don't require INCON's services.  Prototypes and more
  957.      information are available in the header file STRINGZ.H.
  958.  
  959.           The justification routines are capable of returning a string of
  960.      characters, much like BASIC's STRING$() function.  Pass a pointer to a
  961.      destination buffer, another to a null source string, a length, and a
  962.      pad character.  The destination buffer must be at least as long as the
  963.      length you specify, plus an additional byte for the final null.
  964.      Experiment with this feature in the demo program by setting up an
  965.      alpha field with no default input string, non-zero Width, zero Prec,
  966.      and a Pad character.  Then select different justification settings and
  967.      hit [Enter] in the empty input field.
  968.  
  969.           If the string returned from an integer field is to be converted
  970.      to a number, Pad should be the space character (ASCII 32).  Padding
  971.      with "0" (ASCII 48) will not work with a signed integer field and the
  972.      default right justification, since INCON places the sign adjacent to
  973.      the entered digits.  The returned string may be something such as
  974.      "0000-123", which the standard numeric conversion routines will
  975.      translate as 0.
  976.  
  977.  
  978.      Input Templates
  979.  
  980.           INCON uses the character in Fill to mark empty input slots in the
  981.      template.  Since all input slots in a template must contain valid data
  982.      at exit, the presence of a Fill character in the input field is an
  983.      input error.  Therefore, a template cannot be used to obtain input
  984.      that includes the Fill character.
  985.  
  986.  
  987.  
  988.      INCON.DOC                                                      14
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.           For the same reason, the Fill character must not be the same as
  998.      any of the template delimiters.  The template "(999) 999-9999"
  999.      includes a space as a delimiter; if Fill is the space, either by
  1000.      choice or by default, INCON will issue a run-time error.  The small
  1001.      bullet (ASCII 250) and the phantom space (ASCII 255) are generally
  1002.      good choices for Fill.
  1003.  
  1004.           A handy feature of integer templates is that you can imbed
  1005.      prompts within them.  If, for example, you are using fixed-point math
  1006.      to deal with currency, you might set up a STRIPPED integer template
  1007.      such as
  1008.  
  1009.           Amount:  $ 00000.00
  1010.      
  1011.      Users could make entries in familiar dollars and cents, but your
  1012.      program would receive the entry in cents.  Note that quantities of
  1013.      less than $10,000 require leading zeros in the entry because, being a
  1014.      template, the field must be filled completely.  The user may end input
  1015.      with [Numpad +] or [Numpad -], allowing your program to determine
  1016.      whether Amount is positive or negative.
  1017.  
  1018.           INCON will accept the characters that mark input slots in the
  1019.      template string as valid input if Display is set.  If you want to
  1020.      display a default string, you may need to select some out-of-range
  1021.      "flag" value so that your program recognizes when the user has merely
  1022.      pressed [Enter] in the field.  If, given the example above, an amount
  1023.      of 0 were invalid, your program could display an error message if the
  1024.      user pressed [Enter] on the default input string.  If, on the other
  1025.      hand, valid amounts ranged from plus-or-minus 0 to 50,000 you could
  1026.      substitute nines for the zeros in the default input string.  To obtain
  1027.      the entire range of values, from 0 to 99,999.99, you'd have to clear
  1028.      the Display flag.  The initial input field would then be filled with
  1029.      Fill characters, triggering an input error if the user just pressed
  1030.      [Enter] on the empty field.
  1031.  
  1032.           Use mixed templates to obtain patterned data that consists of
  1033.      mixed alpha and numeric data.  Input into mixed templates is more
  1034.      restricted than into other types.  Digits in the template string map
  1035.      input slots that accept only numeric input.  Alpha  input slots accept
  1036.      only alpha entries; no punctuation is allowed.  In addition, case is
  1037.      significant in alpha input slots.  For example,
  1038.  
  1039.           X-999-999-999-999
  1040.      
  1041.      defines a template that accepts only alpha characters in the first
  1042.      input slot and only digits in the remaining slots; INCON converts an
  1043.      entry in the first slot to uppercase.  (That is not an artificial
  1044.      example; Michigan drivers' licenses carry a serial number of that
  1045.      form.  Apparently, someone foresaw the potential for substantial
  1046.      growth in the State's population.
  1047.  
  1048.           Among the public string-handling routines mentioned above is a
  1049.      fairly simple-minded routine that restores a stripped template to its
  1050.      original format.  You pass it a pointer to a template string, a
  1051.  
  1052.  
  1053.  
  1054.      INCON.DOC                                                      15
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.      pointer to the data string you want to format, and a flag character
  1064.      that tells it where the data goes in the template.  For example, if
  1065.      the previous example were used in a database application, you might
  1066.      want to store input in stripped form in order to save space.  To later
  1067.      present the data in its original format for editing, you could pass a
  1068.      template such as
  1069.  
  1070.           x-xxx-xxx-xxx-xxx
  1071.      
  1072.      to the restore routine, TemplStr(), along with the data string and the
  1073.      flag character ("x" in this case).  TemplStr() would plug characters
  1074.      from the data string into the template string at the places marked by
  1075.      the flag character.  Notice that the format of the template string is
  1076.      not as strict as it is for INCON templates.  The only requirement is
  1077.      that the flag character not be the same as any of the template
  1078.      delimiters.
  1079.  
  1080.           INCON offers no dedicated date type, but you could set up
  1081.      templates to get dates in any of several forms.  For example, any of
  1082.      the following templates would serve:
  1083.  
  1084.           "99 Xxx 99"   "XXX 99, 9999"   "99/99/99"
  1085.      
  1086.      The first two are mixed templates for getting dates with the standard
  1087.      three-character month abbreviations; the third may be integer or
  1088.      mixed.  A template is not suited to getting expanded month names
  1089.      because they vary in length.  If you need the date in a form that
  1090.      allows you to do calculations with it, such as verifying leap years
  1091.      and so on, you could set up adjacent fields to get the month, date,
  1092.      and year individually, or use the string-handling routines to parse
  1093.      the return from a template such as one of those above.
  1094.  
  1095.           Editing template fields differs from editing other fields in
  1096.      several ways.  First, the cursor cannot be moved into positions that
  1097.      are occupied by template delimiters.  Second, a "word" in a template
  1098.      field consists of one or more input slots bounded by template
  1099.      delimiters, or by the ends of the field.  Third, INCON does not move
  1100.      characters across word boundaries during deletes.
  1101.  
  1102.  
  1103.      Floating-point Fields
  1104.  
  1105.           INCON sets the Display and Confirm flags in floating-point
  1106.      fields.  It calculates the position of the decimal point in the field
  1107.      from the values of Width and Prec.  If both are 0, INCON bases its
  1108.      calculations on the length of the default input string and the
  1109.      position of the decimal point.  If either is non-zero, it takes
  1110.      precedence; INCON may not succeed in creating an input field in that
  1111.      case.  To find out exactly how INCON handles missing parameters,
  1112.      experiment with the demo program.
  1113.  
  1114.           If you pass a number (converted to an ASCIIZ string) in the i/o
  1115.      buffer, INCON displays it as default input.  INCON fixes a default
  1116.      string that does not conform to the format of the input field by
  1117.  
  1118.  
  1119.  
  1120.      INCON.DOC                                                      16
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.      copying digits from the i/o buffer into the field until it finds the
  1130.      decimal in either the default string or the field.  In the first case,
  1131.      it adjusts the field to close any gaps to the left of the decimal; in
  1132.      the second, it discards uncopied digits to the left of the decimal in
  1133.      the default string.  It then copies digits to the right of the decimal
  1134.      until it either reaches the end of the default string or fills the
  1135.      field.
  1136.  
  1137.           If INCON finds more than one sign character to the left of the
  1138.      decimal in the i/o buffer, it uses the last one and discards any
  1139.      characters found previous to that.  It also discards sign characters
  1140.      to the right of the decimal, as well as all non-digit characters.
  1141.  
  1142.           For example, suppose that you have set up a field of Width 10 and
  1143.      Prec 4.  If you pass a default string of "123.456789", INCON puts
  1144.      "  123.4567" into the input field.  It moves the integer portion of
  1145.      the string adjacent to the decimal point and discards extra digits in
  1146.      the decimal portion, with a resulting loss of precision.  If the
  1147.      default string is "123456.789", it puts "12345.789 " into the input
  1148.      field and discards the extra digit in the integer portion of the
  1149.      string, with a disastrous impact on magnitude.  To avoid such a
  1150.      calamity, be sure that the input field is adequate to hold the largest
  1151.      number likely to be encountered in your data.
  1152.  
  1153.           INCON insists on showing at least one integer position in the
  1154.      input field.  Given Width 10, Prec 9, and a default string of
  1155.      ".123456789", INCON would put "0.12345678" (or "+/-.12345678" if the
  1156.      default input string leads off with a sign) into the input field.  It
  1157.      would reduce Prec to 8 in order to accommodate the integer digit.
  1158.  
  1159.           In order to retain maximum flexibility in editing floating-point
  1160.      fields, all of the edit keys are active.  That means the user can
  1161.      enter a digit, cursor over a place or two, enter another digit, and so
  1162.      on.  Though unlikely, such a clumsy sequence is nonetheless possible.
  1163.      The gaps thus introduced into the input field are eliminated when the
  1164.      user exits the field or whenever the cursor passes over the decimal
  1165.      point.  In addition, when the cursor passes over the decimal from left
  1166.      to right, the integer digits are moved adjacent to the decimal point;
  1167.      if it passes back from right to left, the field is padded out with
  1168.      zeros. If the cursor moves left into the position occupied by the sign
  1169.      (or the first digit if no sign is present), all integer digits are
  1170.      moved back to the beginning of the input field.
  1171.  
  1172.           If the first entry in the input field is a digit or sign (in
  1173.      signed fields only), INCON clears the field and places the entry in
  1174.      the first position.  If the user enters a decimal point before having
  1175.      filled the integer portion of the field, integer digits are moved
  1176.      adjacent to the decimal point and input continues with decimal digits;
  1177.      integer digits that already may have been in place, from the cursor to
  1178.      the decimal point, are discarded.  A decimal point is accepted only
  1179.      when the cursor is in the integer portion of the field; any time one
  1180.      is entered legally, the decimal portion of the field is cleared.
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.      INCON.DOC                                                      17
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.           Here's a sequence of entries and the resulting condition of the
  1196.      input field, given Width 10, Prec 4, Fill character 42, and default
  1197.      input string "123.4567" (the parenthesized character in the third
  1198.      column marks the position of the cursor):
  1199.  
  1200.              Entry             Display             Cursor
  1201.             -------          -----------        ------------
  1202.                                 123.4567          (1)23.4567
  1203.                9              9****.****        9(*)***.****
  1204.                3              93***.****        93(*)**.****
  1205.                .                 93.****           93.(*)***
  1206.                2                 93.2***           93.2(*)**
  1207.             [Right]              93.2***           93.2*(*)*
  1208.                5                 93.2*5*           93.2*5(*)
  1209.              [Home]           93***.2500        (9)3***.2500
  1210.                8              83***.2500        8(3)***.2500
  1211.                .                  8.****            8.(*)***
  1212.             [Enter]               8.0000
  1213.  
  1214.           A sign character is accepted only if the Sign flag is set and the
  1215.      cursor is at the beginning of the field.  In that case, the sign may
  1216.      be entered using either the upper row keys or the Numpad keys.  If
  1217.      Sign is clear or the cursor is not at the beginning of the field, the
  1218.      upper row keys are rejected and the Numpad versions exit the field.
  1219.  
  1220.           If INCON finds a decimal point in the default input string passed
  1221.      to a non-template integer field, it converts the field to signed
  1222.      floating-point.  Initialization then proceeds as above.
  1223.  
  1224.  
  1225.      Scrolling Fields
  1226.  
  1227.           Only non-hidden alpha fields can be scrolled.  INCON turns off or
  1228.      ignores the Scroll flag in numeric, template, and hidden fields, so
  1229.      field length is limited to the width of the Mode 3 screen.  Most edit
  1230.      keys are disabled in hidden fields, so they can't be scrolled to begin
  1231.      with.
  1232.  
  1233.           During word deletes to the left, [Ctrl+L] ceases to function when
  1234.      the cursor reaches the left end of the visible field.  That is a
  1235.      deliberate handicap, intended to prevent the user from accidently
  1236.      deleting characters that are out of view.  During word deletes to the
  1237.      right, INCON moves characters beyond those deleted to the cursor
  1238.      position, so no such precaution is taken.
  1239.  
  1240.  
  1241.  
  1242.                                   Return Codes
  1243.  
  1244.  
  1245.           INCON returns a short integer that indicates the status of the
  1246.      input operation.  Error returns have the high bit set; extended-key
  1247.      codes come back in the low byte of the return value.  Return values
  1248.      and their meanings are listed below.
  1249.  
  1250.  
  1251.  
  1252.      INCON.DOC                                                      18
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.            0   Input accepted; no error.
  1262.                
  1263.                INCON copies user input to the i/o buffer for return to the
  1264.                caller.
  1265.  
  1266.           -1   Input error.
  1267.                
  1268.                Alpha and integer fields:  the user exited the field but has
  1269.                entered fewer than Prec characters.
  1270.                
  1271.                Template fields:  the user exited the field but left at
  1272.                least one input slot vacant.
  1273.  
  1274.           27   Input cancelled.
  1275.                
  1276.                The user pressed [Esc] to abort input.  Pressing [Esc] in an
  1277.                input field that contains data clears the field and input
  1278.                may continue.  Pressing [Esc] in an empty field aborts input
  1279.                and INCON returns to the caller.
  1280.  
  1281.           74   Input accepted; no error.
  1282.           78
  1283.                The user pressed [Numpad -] or [Numpad +] to end input.
  1284.                These returns are subject to special conditions.  See
  1285.                "Special Exit Keys," above.
  1286.  
  1287.           ##   Other extended-key codes.
  1288.                
  1289.                The user pressed a key in the extended-key list to abort
  1290.                input.  INCON ignores keys in the list unless the xKeys flag
  1291.                is set.
  1292.  
  1293.           In most cases, INCON does not alter the default input string on
  1294.      user error or abort.  It does, however, eliminate leading and trailing
  1295.      spaces and control codes during initialization of floating-point and
  1296.      non-template integer fields, so default strings for those fields are
  1297.      always subject to modification.
  1298.  
  1299.           Note that there is no error return for type float.  If the user
  1300.      exits an empty input field, the returned string is made up of "0."
  1301.      padded out with Prec zeros; the initial contents of the i/o buffer are
  1302.      lost.  The only time the default input string comes back unaltered in
  1303.      a floating-point field is when the user presses [Esc] to cancel input.
  1304.  
  1305.           Before returning to the calling routine, INCON restores the
  1306.      cursor to its position at entry.  It needn't be reset if an input
  1307.      error requires that INCON be recalled immediately.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.      INCON.DOC                                                      19
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.                                 Run-Time Errors
  1328.  
  1329.  
  1330.           When INCON encounters a run-time error it beeps, prints a
  1331.      message, and waits for you to press a key; it then returns an error
  1332.      code to the calling routine.  The returned code is one of the error
  1333.      numbers listed below, minus 32768 (the high bit is set).  INCON checks
  1334.      for run-time errors in the order they are listed and flags the first
  1335.      it finds, so there may be more than one.  Correct the one identified
  1336.      in the message; INCON will flag a higher-numbered error at the next
  1337.      run.  Run-time error messages have the form
  1338.  
  1339.           INCON error #: Message text.  Press any key...
  1340.      
  1341.      where # and "Message text" are taken from the list below.  The error
  1342.      message appears in a bar of the color in Attr that extends across the
  1343.      entire screen at the row occupied by the input field; you may suppress
  1344.      it by clearing the Message flag (but see also the Debug flag, above).
  1345.  
  1346.           Error #   Message
  1347.           --------  --------------------------------------------------
  1348.                1    "Invalid field precision"
  1349.                          
  1350.                          Prec is greater than Width.  This error applies to
  1351.                          fields of any type.
  1352.  
  1353.                2    "Invalid field width or scroll visible length"
  1354.                          
  1355.                          Width or Visible is zero, or greater than the
  1356.                          number of screen columns remaining on the line.
  1357.                          This error may occur unexpectedly when Delimit is
  1358.                          set, since the number of columns required for the
  1359.                          input field is increased by two.
  1360.                          
  1361.                          INCON will set Visible itself if you don't
  1362.                          initialize it, taking account of field length and
  1363.                          position, and the space remaining on the screen
  1364.                          row.  If possible, it sets Visible to the same
  1365.                          value as Width, which simplifies string indexing.
  1366.                          If you specifically set Visible to an incorrect
  1367.                          value for a scrolling alpha field, however, INCON
  1368.                          will issue this error, rather than attempting to
  1369.                          override your setting.
  1370.  
  1371.                3    "Default input string too long"
  1372.                          
  1373.                          The input string passed from the caller is longer
  1374.                          than Width characters.
  1375.  
  1376.                4    "Type float; precision is invalid"
  1377.                          
  1378.                          Float precision is 0 or greater than Width.
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.      INCON.DOC                                                      20
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.                5    "Type float; no room for decimal point"
  1394.                          
  1395.                          Width and Prec are equal, leaving no room for the
  1396.                          decimal point.  This error may occur unexpectedly
  1397.                          when INCON forces an integer field to type float
  1398.                          (see the discussion of the Type flag, above).
  1399.  
  1400.                6    "Fill character appears in template"
  1401.                          
  1402.                          At least one template delimiter is the same as the
  1403.                          Fill character.
  1404.  
  1405.                7    "Invalid template"
  1406.                          
  1407.                          No template pattern was supplied in the i/o
  1408.                          buffer, or the one supplied comprises only
  1409.                          delimiters.  In an alpha template only alpha
  1410.                          characters define input slots; in an integer
  1411.                          template only digits; in a mixed template, either
  1412.                          digits or alpha characters.  Spaces and other
  1413.                          punctuation define delimiters.
  1414.  
  1415.                8    "Insufficient memory for internal buffers"
  1416.                          
  1417.                          INCON was unable to allocate memory for its
  1418.                          working buffers.
  1419.  
  1420.                9    "Input/output buffer pointer is NULL"
  1421.                          
  1422.                          The i/o buffer must point to a valid program data
  1423.                          area.
  1424.  
  1425.  
  1426.      Error Trapping
  1427.  
  1428.           INCON attempts to trap several potential run-time errors.  Two of
  1429.      them, forcing signed input and converting field type to floating-
  1430.      point, were mentioned in discussing the Type flag.  Another arises
  1431.      when Width is greater than the remaining length of the screen row and
  1432.      you forget to set Scroll; INCON then sets the flag, sets Visible to
  1433.      carry the field to the end of the row, and clears Delimit.  On the
  1434.      other hand, should you fail to define any value at all for Width,
  1435.      INCON sets it to the length of the default input string; if that, too,
  1436.      is zero, INCON gives up and issues a run-time error.
  1437.  
  1438.           INCON cannot check the length of the i/o buffer against Width.
  1439.      It is the responsibility of the calling routine to insure that the
  1440.      buffer is large enough to hold the requested number of characters,
  1441.      plus the final null byte.
  1442.  
  1443.           You can use INCON's error trapping to simplify parameter-setting
  1444.      in your programs.  For example, you needn't set Width, Prec, or
  1445.      Visible for a template field, since INCON takes all of those
  1446.      parameters from the length of the template.  In most fields,
  1447.  
  1448.  
  1449.  
  1450.      INCON.DOC                                                      21
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.      Attribute, Fill, and Pad can be 0; INCON sets Attribute to inverse
  1460.      video, and Fill and Pad to the ASCII space (keep in mind the
  1461.      restrictions on Fill in templates, however).
  1462.  
  1463.           INCON maintains private copies of the contents of the message
  1464.      block; changes it makes to the parameters you've defined are made to
  1465.      its copies.  If, during debugging, you want to see just what INCON
  1466.      does with the contents of the message block, you can request that it
  1467.      show all parameters and flags after modification, if any, by field
  1468.      initialization.
  1469.  
  1470.           Immediately after initialization, INCON creates a "Stat Box"
  1471.      window at the bottom of the screen, in which it displays the altered
  1472.      flags and parameters (see Figure 4).  The Stat Box will flash on and
  1473.      off as INCON prints the data to the screen and saves it.  If the Debug
  1474.      flag is set, you may then use [Numpad 5] to toggle the Stat Box on and
  1475.      off.  INCON saves and restores the contents of the screen under the
  1476.      Stat Box.
  1477.  
  1478.           Note that you must have compiled INCON.C with the constant
  1479.      INCON_STATS set to a non-zero value for the Stat Box routine to be
  1480.      included in the object file.  If INCON_STATS is 0 when you compile
  1481.      INCON.C, the Stat Box routine and all references to it disappear.  In
  1482.      that case, the only effect of the Debug flag is to turn on the Message
  1483.      flag.
  1484.  
  1485.           The demonstration program, INDEMO.EXE, prints its own Stat Box,
  1486.      which shows the flags and parameters as you've defined them, prior to
  1487.      calling INCON.  Until you exit the newly-created input field, you can
  1488.      toggle INCON's Stat Box on and off to compare your settings with the
  1489.      changes, if any, INCON has made.  See the file INDEMO.DOC for more
  1490.      details.
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.      INCON.DOC                                                      22
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.      Figure 1.  INCON Message Block.
  1528.  
  1529.  
  1530.             Offset        Low Byte  |  High Byte
  1531.                         +-----------------------+
  1532.               0         |         BufOff        |
  1533.                         |-----------------------|
  1534.               1         |         BufSeg        |
  1535.                         |-----------------------|
  1536.               2         |         KeyOff        |
  1537.                         |-----------------------|
  1538.               3         |         KeySeg        |
  1539.                         |-----------------------|
  1540.               4         |         Flags         |
  1541.                         |-----------+-----------|
  1542.               5         |   Width   |   Prec    |
  1543.                         |-----------+-----------|
  1544.               6         |  Visible  |   Attr    |
  1545.                         |-----------+-----------|
  1546.               7         |   Fill    |   Pad     |
  1547.                         +-----------+-----------+
  1548.  
  1549.  
  1550.  
  1551.      Figure 2.  INCON Flags.
  1552.  
  1553.  
  1554.      Bit:   15        14  13  12     11     10       9          8
  1555.              |          \  | /         \   /         |          |
  1556.            Debug         Type         Justify      Strip     Message
  1557.            -------   -------------   ----------   -------   ---------
  1558.            0 = No    0 = Alpha       0 = None     0 = No     0 = No
  1559.            1 = Yes   1 = Uppercase   1 = Left     1 = Yes    1 = Yes
  1560.                      2 = Integer     2 = Center
  1561.                      3 = Float       3 = Right
  1562.                      4 = Mixed
  1563.  
  1564.      Bit:    7      6       5       4      3      2      1      0
  1565.              |      |       |       |      |      |      |      |
  1566.             Sign Display Confirm Delimit xKeys  Scroll  Hide Template
  1567.             ---- ------- ------- ------- ----- -------- ---- --------
  1568.                            For all:  0 = No / 1 = Yes
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.      INCON.DOC                                                      23
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.      
  1592.  
  1593.  
  1594.  
  1595.  
  1596.      Figure 3.  The INCON Interface.
  1597.  
  1598.  
  1599.  
  1600.  
  1601.      MBLOCK nblock;
  1602.      
  1603.      a)  Declaring a message block.
  1604.  
  1605.  
  1606.  
  1607.  
  1608.      nblock.iblock[0] = FP_OFF( ioBuffer );
  1609.      nblock.iblock[1] = FP_SEG( ioBuffer );
  1610.      nblock.iblock[2] = FP_OFF( xKeyList );
  1611.      nblock.iblock[3] = FP_SEG( xKeyList );
  1612.      nblock.iblock[4] = FLAG_INTGR   |
  1613.                         FLAG_RJUST   |
  1614.                         FLAG_DISPLAY |
  1615.                         FLAG_CONFIRM |
  1616.                         FLAG_XKEYS   ;
  1617.      nblock.iblock[5] = WIDTH   | (PREC << 8);
  1618.      nblock.iblock[6] = VISIBLE | (ATTR << 8);
  1619.      nblock.iblock[7] = FILL    | (PAD  << 8);
  1620.      
  1621.      b)  Initializing the message block as an integer array.
  1622.  
  1623.  
  1624.  
  1625.  
  1626.      MBLOCK far * block_ptr = &nblock;
  1627.      
  1628.      c)  Defining the message block pointer.
  1629.  
  1630.  
  1631.  
  1632.  
  1633.      short incon_ret = InCon( block_ptr );
  1634.      
  1635.      d)  Calling INCON.
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.      INCON.DOC                                                      24
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.      
  1660.  
  1661.  
  1662.  
  1663.  
  1664.      Figure 4.  The INCON Stat Box.
  1665.      
  1666.           Parameters are shown in hexidecimal (X); flags in binary (B).
  1667.  
  1668.  
  1669.  
  1670.  
  1671. ╔════════════════════════════════════════════════════════════════════════════╗
  1672. ║ INCON 3.1                            Copyright (c) 1993-94, Richard Zigler ║
  1673. ║ ioBuf segment:offset = XXXX:XXXX       xKeyList segment:offset = XXXX:XXXX ║
  1674. ║ Width:  XX   Prec:  XX   Visible:  XX     Attr:  XX   Fill:  XX   Pad:  XX ║
  1675. ║ Flags:  B BBB BB B B B B B B B B B B     Use [Numpad 5] to toggle Stat Box ║
  1676. ╚════════════════════════════════════════════════════════════════════════════╝
  1677.  
  1678.  
  1679.  
  1680.  
  1681.      Table  1.  INCON's Handling of [Numpad +] and [Numpad -]
  1682.      
  1683.           (X means "don't care").
  1684.  
  1685.  
  1686.  
  1687.  
  1688.            Field     Sign     Template
  1689.            Type      Flag       Flag         Action
  1690.           -------   ------    --------       -------------------------
  1691.           Alpha       X          X           Map to upper row +/-.
  1692.           Integer     0          0           Exit, return scan code.
  1693.           Integer     1          0           Sign in first position;
  1694.                                               else exit, return scan.
  1695.           Integer     X          1           Exit, return scan code.
  1696.           Float       1          X           Sign in first position;
  1697.                                               else exit, return scan.
  1698.           Float       0          X           Exit, return scan code.
  1699.           Mixed       X          1           Illegal; audible warning.
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.      INCON.DOC                                                      25
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.      Table  2.  INCON Edit Keys.
  1726.  
  1727.  
  1728.      Key(s)         Normal Field              Template Field
  1729.      ----------     ----------------------    ----------------------
  1730.      [Home]         Move cursor to start      Move cursor to first
  1731.                     of input string.          input slot.
  1732.      
  1733.      [End]          Move cursor to end        Move cursor to last
  1734.                     of input string.          input slot.
  1735.      
  1736.      [Left]         Move cursor to            Move cursor to
  1737.                     previous character.       previous input slot.
  1738.      
  1739.      [Right]        Move cursor to            Move cursor to
  1740.                     next character.           next input slot.
  1741.      
  1742.      [Ctrl+Home]    Clear input field from    Clear input slots from
  1743.                     cursor to beginning.      cursor to beginning.
  1744.      
  1745.      [Ctrl+End]     Clear input field         Clear input slots
  1746.                     from cursor to end.       from cursor to end.
  1747.      
  1748.      [Ctrl+Left]    Move cursor to            Move cursor to previous
  1749.                     previous word.            input group.
  1750.      
  1751.      [Ctrl+Right]   Move cursor to            Move cursor to next
  1752.                     next word.                input group.
  1753.      
  1754.      [Ctrl+L]       Delete word left.         Delete group left.
  1755.      
  1756.      [Ctrl+R]       Delete word right.        Delete group right.
  1757.      
  1758.      [Backspace]    Delete character          Clear input slot
  1759.                     left.                     left.
  1760.      
  1761.      [Del]          Delete character          Clear input slot
  1762.                     at cursor.                at cursor.
  1763.      
  1764.      [Esc]          Clear entire input        Clear all input
  1765.                     field.                    slots.
  1766.      
  1767.      [Esc]+[Esc]    Cancel input.             Cancel input.
  1768.      
  1769.      [Enter]        End input.                End input.
  1770.      
  1771.      [Keypad +]     Sign or special exit.     Special exit.
  1772.      
  1773.      [Keypad -]     Sign or special exit.     Special exit.
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.      INCON.DOC                                                      26
  1781.  
  1782.  
  1783.